package crud.controller;

import crud.bean.Dept;
import crud.bean.Msg;
import crud.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 处理和部门有关的请求
 * @Author Bai Xu
 * @Date 2021/8/7 21:15
 * @Version 1.0
 */
@Controller
public class DeptController {
    @Autowired
    private DeptService deptService;
    @RequestMapping("/depts")
    @ResponseBody
    public Msg getDepts(){
        //查出的所有部门信息
     List<Dept> list= deptService.getDepts();
    return   Msg.success().add("depts", list);
    }
}
